<?php
/**
 * The response object.
 * @todo Add the header handling etc.
 */
class Response {
    protected $headers = array();

    /**
     * Set a header.
     */
    public function setHeader($header, $value) {
        $this->headers[$header] = $value;
    }

    /**
     * Get a header.
     */
    public function getHeader($header) {
        return $this->headers[$header];
    }

    /**
     * Get all headers.
     */
    public function getHeaders() {
        return $this->headers;
    }

    /**
     * Send all headers.
     */
    public function sendHeaders() {
        foreach($this->headers as $header => $value) {
            header("$header: $value");
        }
    }

    /**
     * Clear all headers.
     */
    public function clearHeaders() {
        $this->headers = array();
    }

    /**
     * Clear a single header.
     */
    public function clearHeader($header) {
        unset($this->headers[$header]);
    }
}
?>
